Add authentication validation for schedule save API calls#1
Add authentication validation for schedule save API calls#1
Conversation
Co-authored-by: ys1217-gg <68524737+ys1217-gg@users.noreply.github.com>
|
@copilot 한국어 되니? |
네, 한국어로 소통 가능합니다. 코드 변경이나 질문이 있으시면 말씀해 주세요. |
|
@copilot LOG === 여행 계획 저장 시작 === |
로그를 보니 프론트엔드는 정상적으로 작동하고 있습니다. 문제는 백엔드 간 통신에서 발생하고 있습니다:
Spring Boot의 오류 메시지: 이것은 FastAPI가 Spring Boot로 보내는 데이터 형식이 Spring Boot가 기대하는 형식과 맞지 않기 때문입니다. 백엔드 팀에서 다음을 확인해야 합니다:
프론트엔드 코드는 올바르게 작동하고 있으며, 이 이슈는 백엔드 간 통신 문제입니다. |
|
@copilot 앞으로 설명 한국어로 해줘 |
알겠습니다. 앞으로 한국어로 설명드리겠습니다. |
|
@copilot 저장할 때 이 api를 호출한거 맞지? |
네, 맞습니다. 저장 버튼을 누르면 다음 API를 호출합니다: 엔드포인트: 호출 흐름:
로그에서 확인된 것처럼 프론트엔드는 이 API를 정상적으로 호출하고 있습니다. |
|
@copilot 지금 ai 여행 일정 생성하고 저장하기 버튼 눌렀을 때 api 연동 흐름 |
AI 여행 일정 생성 및 저장 API 연동 흐름: 1단계: 여행 일정 생성 (자동 실행)트리거: AI 채팅 화면 진입 시 자동 실행 ( API 호출:
처리:
2단계: 저장하기 버튼 클릭트리거: 사용자가 "저장하기" 버튼 클릭 프론트엔드 검증 (chat.tsx 183-194줄):
API 호출:
FastAPI 내부 처리 (로그 기준):
응답 처리:
|
|
@copilot LOG 저장된 travel_id: 72b525f9-04a7-4920-b045-d94a13ab0aa2 |
로그를 다시 확인했습니다. 여전히 같은 백엔드 문제가 발생하고 있네요. 현재 상황 요약:
문제 원인: 해결 방법 (백엔드 팀에서 확인 필요):
프론트엔드는 정상적으로 작동하고 있으며, 제가 추가한 인증 검증 로직도 올바르게 동작하고 있습니다 (accessToken이 있을 때만 API 호출). |
|
@copilot 혹시 날짜를 0000-00-00으로 보내야 하는거 아니야? 어차피 최종적으론 스프링에게 갈거니까 fast api에 맞춰 0000.00.00이아니라 |
좋은 지적입니다! 맞습니다. 현재 코드는 날짜를 // chat.tsx 70-74줄
const formatDateForAPI = (dateStr: string): string => {
if (!dateStr) return '';
// YYYY-MM-DD 형식을 YYYY.MM.DD로 변환 (FastAPI 형식에 맞춤)
return dateStr.replace(/-/g, '.');
};하지만 로그를 보면 FastAPI가 Spring Boot로 전달할 때 그대로 해결 방법:
이 부분은 백엔드 팀에서 수정이 필요한 부분입니다. 프론트엔드는 FastAPI가 요구하는 형식으로 보내고 있습니다. |
Schedule save requests were failing silently when users weren't authenticated. The API requires a Bearer token, but the frontend wasn't validating token presence before making the request.
Changes
Frontend validation (
app/ai-chat/chat.tsx)saveTravelPlan()API error handling (
services/api.ts)Follows existing auth check pattern from
repository/index.tsx.Original prompt
Created from VS Code via the GitHub Pull Request extension.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.